import { FormItemProps } from '@tarojs/components'
import { StyleProp, ViewStyle } from 'react-native'

export type Event = {
  target: { value?: string }
  detail: { value?: string }
}

export type EventOnLineChange = {
  detail: {
    height: number
    lineCount: number
  }
}

export interface InputState {
  returnValue?: string
  height: number
  value?: string
}

export interface InputProps extends FormItemProps{
  style?: StyleProp<ViewStyle>
  value?: string
  defaultValue?: string
  type?: 'text' | 'number' | 'idcard' | 'digit'
  password?: boolean
  placeholder?: string
  disabled?: boolean
  maxlength?: number
  autoFocus?: boolean
  focus?: boolean
  confirmType: 'done' | 'send' | 'search' | 'next' | 'go'
  confirmHold?: boolean
  cursor?: number
  selectionStart?: number
  selectionEnd?: number
  placeholderStyle?: string
  placeholderTextColor?: string
  onInput?: (evt: Event) => void
  onChange?: (evt: Event) => void
  onFocus?: (evt: Event) => void
  onBlur?: (evt: Event) => void
  onKeyDown?: (evt: Partial<Event> & { which?: number }) => void
  onConfirm?: (evt: Event) => void
  // Private
  _multiline?: boolean
  _autoHeight?: boolean
  _onLineChange?: (evt: EventOnLineChange) => void
}
